<template>
	<view class="main">
			<u-navbar :is-back="true" title="添加分类" :background="background" back-icon-color="#000000" title-color="#000" title-bold="true"></u-navbar>
		<view class="type">
			<input type="text" placeholder="输入分类" v-model="type" />
		</view>
		<view class="confirm" @click="selecttype">
			确定添加
		</view>
	</view>
</template>
<script>


	export default {
		data() {
			return {
				background: {
					backgroundColor:'#fff'
				},
				type:'',

			}
		},
		onLoad() {
			
			
		},
		mounted() {
		
		},
		onShow() {},
		methods: {
		selecttype(){
			global.$http.request({
				url:'/shopapi/goods/goodsCategoryadd',
				data:{
					name:this.type,
					token:uni.getStorageSync('token'),
				}
			}).then((res)=>{
				if(res.data.code==200){
					uni.showToast({
						title:res.data.msg,
						icon:'none',
						duration:1000
					})
					setTimeout(function(){
						uni.navigateBack({
							delta:1
						})
					},1000)
				}
				this.type=''
			})
		},
	
		}
	}
</script>
<style lang="scss">
	page {
		font-family: PingFang SC;
		width: 750rpx;
		margin: 0 auto;
		
		background-color: #f7f7f7;
		.main {
			width: 750rpx;
			margin: 0 auto;
		.type{
			padding: 31rpx 30rpx;
			margin-top: 10rpx;
			background-color: #fff;
		}
			.confirm{
				position: absolute;
				bottom: 0;
				width: 750rpx;
				text-align: center;
				padding: 34rpx 0;
				background: #FE4E00;
				font-size: 32rpx;
				font-weight: 400;
				color: #FFFFFF;
			}
		}
	}
</style>
